﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class employee2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TUser1.CheckUser(this);

            //设定状态
            if ((this.Session["ecrm_email"] == null) || (this.Session["ecrm_email"].ToString() == ""))
            {
                userstatus1.Text = "你好，请 <a href=\"../main.aspx\">登录</a>或 ";
                userstatus2.Text = "<a href=\"../user/user_reg.aspx\">注册</a>";
            }
            else
            {
                string sid = this.Session["ecrm_uid"].ToString();
                TUser oUser = new TUser(sid);
                oUser.Select();
                string bigname = oUser.BigName;

                userstatus1.Text = "<a onclick='javascript:location.href=\"./user/user_myself.aspx\"' onmouseover='this.style.cursor=\"pointer\"' onmouseout='this.style.backgroundColor=\"\"'>" + bigname + "的设置</a>";
                userstatus2.Text = "<a onclick='javascript:location.href=\"./user/user_logout.aspx\"' onmouseover='this.style.cursor=\"pointer\"' onmouseout='this.style.backgroundColor=\"\"'>退出</a>";
            }

            employeelist.InnerHtml = GenList();
        }
    }

    private string GenList()
    {
        string result = "";
        int iNum = 1;
        result += "<table  border=\"1\" cellpadding=\"2\" cellspacing=\"0\" style='BORDER-COLLAPSE: collapse' bordercolor=\"#cfdfff\" width=\"700\" align=\"center\">";
        result += "<tr height=26 bgcolor=\"#ecf5ff\"><td colspan=6 align=center>汽车中国</td></tr>";
        result += "<tr height=26>";
        result += "<td align=center>序号</td><td>姓名</td><td align=center>部门</td><td>手机</td><td>座机</td><td>电子邮箱</td>";
        result += "</tr>";
        result += "<tbody>";
        string sSql = "select linkman,dept,mobile,tel,email from t_linkman where company like '%汽车画报%' order by dept,linkman";
        TSqlDBReader oList = new TSqlDBReader(sSql);
        while (oList.FDataReader.Read())
        {
            result += "<tr height=26>";
            result += "<td align=center>" + iNum.ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(0).ToString() + "</td>";
            result += "<td align=center>" + oList.FDataReader.GetValue(1).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(3).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(4).ToString() + "</td>";
            result += "</tr>";
            iNum++;
        }
        oList.Free();
        result += "</tbody>";

        iNum = 1;
        result += "<tr height=26 bgcolor=\"#ecf5ff\"><td colspan=6 align=center>动感驾驭</td></tr>";
        result += "<tbody>";
        sSql = "select linkman,dept,mobile,tel,email from t_linkman where company like '%动感驾驭%' order by dept,linkman";
        oList = new TSqlDBReader(sSql);
        while (oList.FDataReader.Read())
        {
            result += "<tr height=26>";
            result += "<td align=center>" + iNum.ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(0).ToString() + "</td>";
            result += "<td align=center>" + oList.FDataReader.GetValue(1).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(3).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(4).ToString() + "</td>";
            result += "</tr>";
            iNum++;
        }
        oList.Free();
        result += "</tbody>";

        iNum = 1;
        result += "<tr height=26 bgcolor=\"#ecf5ff\"><td colspan=6 align=center>汽车在线</td></tr>";
        result += "<tbody>";
        sSql = "select linkman,dept,mobile,tel,email from t_linkman where company like '%汽车在线%' order by dept,linkman";
        oList = new TSqlDBReader(sSql);
        while (oList.FDataReader.Read())
        {
            result += "<tr height=26>";
            result += "<td align=center>" + iNum.ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(0).ToString() + "</td>";
            result += "<td align=center>" + oList.FDataReader.GetValue(1).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(2).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(3).ToString() + "</td>";
            result += "<td>" + oList.FDataReader.GetValue(4).ToString() + "</td>";
            result += "</tr>";
            iNum++;
        }
        oList.Free();
        result += "</tbody>";

        result += "</table>";
        return result;
    }
}
